package com.lmx.repoDomain.tmodel;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;
/**
 * 现病史表
 * @author jing
 *
 */
@JsonApiResource(type = "diseasehistory")
@Table(name = "tnb_disease_history")
@Entity
public class DiseaseHistory extends BaseEntity {

//	private List<Dicttype> diseaseType = new ArrayList<Dicttype>();   //疾病的类别，可多选
	
	private Dicttype diseaseType ; //疾病的类别，可多选
	
	private HealthRecord healthrecord; //对应的健康档案表
	
	private String tumourRemark; //肿瘤的备注
	
	private String occupationRemark; //职业病备注	
	
	private String otherRemark; //其他备注
	

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "health_record_id", foreignKey = @ForeignKey(name = "null"))
	public HealthRecord getHealthrecord() {
		return healthrecord;
	}    

	public void setHealthrecord(HealthRecord healthrecord) {
		this.healthrecord = healthrecord;
	}

	@Column(name="tumour_remark")
	public String getTumourRemark() {
		return tumourRemark;
	}

	public void setTumourRemark(String tumourRemark) {
		this.tumourRemark = tumourRemark;
	}

	@Column(name="occupation_remark")
	public String getOccupationRemark() {
		return occupationRemark;
	}

	public void setOccupationRemark(String occupationRemark) {
		this.occupationRemark = occupationRemark;
	}

	@Column(name="other_remark")
	public String getOtherRemark() {
		return otherRemark;
	}

	public void setOtherRemark(String otherRemark) {
		this.otherRemark = otherRemark;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "diseasetype_id", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getDiseaseType() {
		return diseaseType;
	}

	public void setDiseaseType(Dicttype diseaseType) {
		this.diseaseType = diseaseType;
	}

	
}
